<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateKycTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('kyc', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('username',15)->nullable()->comment('用户名称');
            $table->string('type',20)->default('level_one')->comment('level_one，level_two，level_three');
            $table->tinyInteger('state')->default(0)->comment('审核状态0，1，2');
            $table->timestamp('check_time')->nullable()->comment('审核时间');
            $table->string('reject_reason')->nullable()->comment('驳回理由');

            $table->string('country',100)->nullable()->comment('国家');
            $table->string('certificate_type',100)->nullable()->comment('证件类型');
            $table->string('certificate_account',100)->nullable()->comment('证件号码');
            $table->string('name_one',100)->nullable()->comment('姓名');
            $table->string('name_two',100)->nullable()->comment('姓名中的姓氏（外国）');
            $table->string('positive',200)->nullable()->comment('人像面');
            $table->string('contrary',200)->nullable()->comment('国徽面');
            $table->string('video',200)->nullable()->comment('生活照');

            $table->tinyInteger('check_status')->default(0)->comment('自动检查状态');
            $table->string('check_msg')->default('')->comment('自动检查信息');
            $table->tinyInteger('check_contrary_status')->default(0)->comment('自动检查状态（证件2）');
            $table->string('check_contrary_msg')->default('')->comment('自动检查信息（证件2）');

            $table->timestamp('add_time')->default(DB::raw('CURRENT_TIMESTAMP'))->comment('添加时间');
            $table->engine = 'InnoDB';
            $table->charset = 'utf8';
            $table->collation = 'utf8_unicode_ci';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('kyc');
    }
}
